package com.tanhua.model.vo;

import com.tanhua.model.mongo.Dimensions;
import com.tanhua.model.mongo.QuestionnaireReport;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.List;

/**
 * @Desciption:test
 * @Create by:金木yan
 * @Date: 2021/12/10 20:07
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class QuestionnaireReportVo implements Serializable {
    private String id; //报告id
    private String questionnaireId; //问卷id
    private Long userId; //当前登录用户id
    private String cover; //鉴定图片
    private String conclusion; //报告内容
    private Integer totalScore; //总分
    private List<?> dimensions; //维度
    private List<?> similarYou; //与你相似
    private String created; //创建时间
    private String updated;  //修改时间

    //构建vo
    public static QuestionnaireReportVo init(QuestionnaireReport report, List<Dimensions> dimensionsList, List<SimilarYou> similarYouList) {
        QuestionnaireReportVo reportVo = new QuestionnaireReportVo();
        BeanUtils.copyProperties(report, reportVo);
        reportVo.setId(report.getId().toHexString());
        reportVo.setQuestionnaireId(report.getQuestionnaireId().toHexString());
        reportVo.setDimensions(dimensionsList);
        reportVo.setSimilarYou(similarYouList);
        return reportVo;
    }
}
